﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SymbolChains.aspx.cs" Inherits="Tradier.SymbolChains" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <asp:TextBox ID="uxSymbol" runat="server"></asp:TextBox>
            <asp:Button ID="uxSearchButton" runat="server" Text="Search" OnClick="OnSearchButtonClicked" />
        </div>
        <%if (Chains != null && Chains.Count > 0)
          {

              foreach (var chain in Chains)
              {
                  var chainItems = chain.Value;
        %>
        <div>
            Date :
            <%= chain.Key%></div>
        <div>
            <table>
                <thead>
                    <tr>
                        <th colspan="5">
                            Call
                        </th>
                        <th>
                            
                        </th>
                        <th colspan="5">
                            Put
                        </th>
                    </tr>
                    <tr>
                        <th>
                            Last
                        </th>
                        <th>
                            Bid
                        </th>
                        <th>
                            Ask
                        </th>
                        <th>
                            Volume
                        </th>
                        <th>
                            Change
                        </th>
                        <th>
                            Strike
                        </th>
                        <th>
                            Last
                        </th>
                        <th>
                            Bid
                        </th>
                        <th>
                            Ask
                        </th>
                        <th>
                            Volume
                        </th>
                        <th>
                            Change
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <%for (int i = 0; i < chainItems.Count; i = i + 2)
                      {
                    %>
                    <tr>
                        <td>
                            <%=chainItems[i].Last%>
                        </td>
                        <td>
                            <%=chainItems[i].Bid%>
                        </td>
                        <td>
                            <%=chainItems[i].Ask%>
                        </td>
                        <td>
                            <%=chainItems[i].Volume%>
                        </td>
                        <td>
                            <%=chainItems[i].Change%>
                        </td>
                        <td>
                            <%=chainItems[i].Strike%>
                        </td>
                        <td>
                            <%=chainItems[i+1].Last%>
                        </td>
                        <td>
                            <%=chainItems[i + 1].Bid%>
                        </td>
                        <td>
                            <%=chainItems[i + 1].Ask%>
                        </td>
                        <td>
                            <%=chainItems[i + 1].Volume%>
                        </td>
                        <td>
                            <%=chainItems[i + 1].Change%>
                        </td>
                    </tr>
                    <%} %>
                </tbody>
            </table>
        </div>
        <% }
          } %>
    </div>
    </form>
</body>
</html>
